from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import JsonResponse

class LoginRequiredJSONMixin(LoginRequiredMixin):
    '''自定义判断用户是否登录的拓展类：返回JSON'''
    def handle_no_permission(self):
        '''直接响应JSON数据'''
        return JsonResponse({'code':4003,'errormsg':'用户未登录'})